import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import '../../AppConfig/Config.dart';
import '../../l10n/messages.dart';

class ReceiptVoucher extends StatefulWidget {
  const ReceiptVoucher({super.key});

  @override
  State<ReceiptVoucher> createState() => _ReceiptVoucherState();
}

class _ReceiptVoucherState extends State<ReceiptVoucher> {
  List moneyList=["300.00","200.00"];
  List chooseList=[];
  @override
  Widget build(BuildContext context) {
    var messages = AppLocalizations.of(context)!;
    final screenSize = MediaQuery.of(context).size;
    return Scaffold(
      backgroundColor: MyColors.backgreyColor,
      appBar: AppBar(
        backgroundColor: Colors.white,
        centerTitle: true,
        title: Text("收款凭证",style: TextStyle(color: Colors.black,fontWeight: FontWeight.w300,fontSize: 16.sp),),
      ),
      body:   Column(
        children: [
          Expanded(child:Container(
            height: moneyList.length*108.h,
            child:  ListView.builder(
                itemCount: moneyList.length,
                itemBuilder: (BuildContext context, int index) {
                  return   Container(
                    margin: EdgeInsets.only(left: 10.w,right: 10.w,top: 8.h),
                    padding: EdgeInsets.only(left: 8.w,right: 8.w,top: 10.h,bottom: 10.h),
                    decoration: BoxDecoration(
                      color: Colors.white,
                      borderRadius: BorderRadius.all(Radius.circular(10),),
                    ),
                    child: Column(
                      children: [
                        Row(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          children: [
                            Row(
                              children: [
                                Text("苏州"+" "+"吴中",style: TextStyle(color: Colors.black,fontWeight: FontWeight.w600),),
                                SizedBox(width: 8.w,),
                                Icon(Icons.trending_flat,),
                                SizedBox(width: 8.w,),
                                Text("宁波"+" "+"北仑",style: TextStyle(color: Colors.black,fontWeight: FontWeight.w600),),
                              ],
                            ),
                            Text("2023-03-27 10:20",style: TextStyle(color: MyColors.textColor,fontSize: 12.sp),),
                          ],
                        ),
                        SizedBox(height: 20.h,),
                        Row(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          children: [
                            Row(
                              crossAxisAlignment: CrossAxisAlignment.end,
                              children: [
                                SizedBox(width: 40.w,),
                                Text("¥",style: TextStyle(color: MyColors.themeColor,),),
                                Text(moneyList[index],style: TextStyle(color: MyColors.themeColor,fontSize: 20.sp),),
                              ],
                            ),
                            IconButton(
                                onPressed: (){
                                  setState(() {
                                    chooseList.contains(index)?
                                    chooseList.remove(index):chooseList.add(index);
                                    print(chooseList);
                                  });
                                },

                                icon:  chooseList.contains(index)?Icon(Icons.
                                check_circle,color: MyColors.themeColor,)
                                    :Icon(Icons.panorama_fish_eye,color: MyColors.hintColor,)),


                          ],
                        ),
                      ],
                    ),
                  );
                }
            ),
          ),
          ),
          Container(
            height: 122.h,
            color: Colors.white,
            padding: EdgeInsets.only(top: 10.h,right: 10.w,left: 10.w),
            child: Column(

              children: [
                Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: [
                    Row(
                      children: [
                        Text("*",style: TextStyle(color: Colors.red),),
                        Text("发送邮箱",style: TextStyle(color: Colors.black),),
                      ],
                    ),

                    Container(
                      height: 30.h,
                      width: 230.w,
                      decoration: BoxDecoration(
                          borderRadius: BorderRadius.all(Radius.circular(30))),
                      child:   TextField(
                        decoration: InputDecoration(
                          hintText: '请输入邮箱地址',
                          hintStyle:TextStyle(fontSize: 12.sp,color: MyColors.textColor),
                          filled: true,
                          fillColor: MyColors.backgreyColor,
                          border: InputBorder.none,
                          alignLabelWithHint: true,
                          contentPadding: EdgeInsets.symmetric(vertical: 10.0.h, horizontal: 10.0.w),
                        ),
                        textAlign: TextAlign.right,
                        style: TextStyle(color: Colors.black),
                        onChanged: (value) {
                          setState(() {
                           print(value);
                          });
                        },
                      ),
                    ),

                  ],
                ),
                SizedBox(height: 10.h,),
                Container(
                    height: 40.h ,
                    margin: EdgeInsets.only(left: 30.w,right: 30.w),
                    decoration: BoxDecoration(
                        color:Color.fromRGBO(231, 112, 27, 0.85),
                        borderRadius: BorderRadius.all(Radius.circular(30))),

                    width: double.infinity,


                    child: TextButton(
                      child: Text(messages["提交"],style: TextStyle(color: Colors.white,fontSize: 14.sp),),

                      onPressed: (){

                      },
                    )
                ),
              ],
            ),
          ),
        ],
      ),


    );
  }
}
